
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../layuiadmin/layui-v2.5.5/layui/css/layui.css" media="all" type="text/css">
</head>
<script type="text/javascript" src="../../layuiadmin/lib/jquery.min.js"></script>
<script>
    var data=parent.PartitionId;
    $(function(){
        $("#teamName").val(data[0].teamName);
        $("#teamPrincipal").val(data[0].teamPrincipal);
        $("#teamMember").val(data[0].teamMember);
        $("#teamOperation").val(data[0].teamOperation);
        $("#teamId").val(data[0].teamId);
    })  ;
</script>
<body>
<form class="layui-form" action="" lay-filter="example" id="form1">
<div class="layui-form-item">
  <input name="teamId" id="teamId" type="hidden">
                     <label class="layui-form-label">团队名称</label>
                     <div class="layui-input-block">
                         <input name="teamName" id="teamName" class="layui-input" type="text" placeholder="请输入姓名" autocomplete="off" lay-verify="title">
                     </div>
                 </div>
                        <div class="layui-form-item">
                                      <label class="layui-form-label">团队负责人</label>
                                      <div class="layui-input-block">
                                          <input name="teamPrincipal" id="teamPrincipal" class="layui-input" type="text" placeholder="请输入负责人" autocomplete="off" lay-verify="title">
                                      </div>
                                  </div>
             <div class="layui-form-item">
                                               <label class="layui-form-label">团队成员</label>
                                               <div class="layui-input-block">
                                                   <input name="teamMember" id="teamMember" class="layui-input" type="text" placeholder="请输入团员" autocomplete="off" lay-verify="title">
                                               </div>
                                           </div>
               <div class="layui-form-item">
                                                       <label class="layui-form-label">团队操作</label>
                                                       <div class="layui-input-block">
                                                           <input name="teamOperation" id="teamOperation" class="layui-input" type="text" placeholder="团队操作" autocomplete="off" lay-verify="title">
                                                       </div>
                                                   </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" type="submit" lay-filter="demo1" lay-submit="">立即提交</button>
                    </div>
                </div>
</form>
<script src="../../layuiadmin/layui-v2.5.5/layui/layui.js" type="text/javascript"></script>
<script type="text/javascript" src="../../layuiadmin/lib/jquery.min.js"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script type="text/javascript">
    layui.use(['form', 'layedit', 'laydate','upload'], function(){
        var $ = layui.jquery
            ,upload = layui.upload
            ,form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;
        //日期
        laydate.render({
            elem: '#workhistoryStartdate'
        });
        laydate.render({
            elem: '#workhistoryEnddate'
        });
        //创建一个编辑器
        var editIndex = layedit.build('LAY_demo_editor');
        //自定义验证规则
        form.verify({
            title: function(value){
                if(value.length < 1){
                    return '请输入';
                }
            }
            ,title1: function(value){
                if(value.length < 1){
                    return '请选择';
                }
            }
            ,pass: [
                /^[\S]{6,12}$/
                ,'密码必须6到12位，且不能出现空格'
            ]
            ,content: function(value){
                layedit.sync(editIndex);
            }
        });
                  //监听提交
                      form.on('submit(demo1)', function(data){
                          var data1=$("#form1").serialize();
                          $.ajax({
                              type:"POST",
                              url:"http://localhost:8080/HrEmp/teamupdate",
                              data:data1,
                              success:function(data){
                                  layer.alert('修改成功',function(){
                                      parent.layer.closeAll();
                                  })
                                  parent.layui.table.reload('listteam')
                              },error:function(){
                                  alert("失败")
                              }
                          });
                          return false;
           });
        //表单取值
        layui.$('#LAY-component-form-getval').on('click', function(){
            var data = form.val('example');
            alert(JSON.stringify(data));
        });

    });
</script>

</body>
</html>